﻿@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
    Layout = null;
}

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Demo</title>
    <link href="~/libs/layui-v2.9.17/layui/css/layui.css" rel="stylesheet" />
    <script src="~/libs/layui-v2.9.17/layui/layui.js"></script>
    <script src="~/libs/jquery/jquery.js"></script>
</head>
<body>
    <form class="layui-form" action="" onsubmit="return false">
        <div class="layui-form-item">
            <label class="layui-form-label">退货单编号</label>
            <div class="layui-input-block">
                <input type="text" id="returnCode" name="returnCode" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">退货单名称</label>
            <div class="layui-input-block">
                <input type="text" id="returnName" name="returnName" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">采购订单编号</label>
            <div class="layui-input-block">
                <input type="text" id="purchaseCode" name="purchaseCode" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">供应商</label>
            <div class="layui-input-block">
                <input type="text" id="vendorName" name="vendorName" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">批次号</label>
            <div class="layui-input-block">
                <input type="text" name="batchCode" id="batchCode" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">退货日期</label>
            <div class="layui-input-inline">
                <input type="date" id="returnDate" name="returnDate" lay-verify="date" placeholder="请输入" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">单据状态</label>
            <div class="layui-input-block">
                <select name="status" id="status" lay-verify="required" lay-search>
                    <option value="" name="status">请选择单据状态</option>
                    <option value="未完成" name="status">未完成</option>
                    <option value="已完成" name="status">已完成</option>
                </select>
            </div>
        </div>

        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <textarea placeholder="请输入内容" class="layui-textarea" id="remark" name="remark"></textarea>
            </div>
        </div>
        <input type="hidden" id="id" name="id" />
    </form>
    <script type="text/javascript">
        layui.use('form', function () {
            const form = layui.form;
            form.render();
            var id = window.location.search.substring(4);
            $.ajax({
                url: '/XiangHe/GetReturnOrder?id=' + id,
                type: 'get',
                data: $('#form').serialize(),
                success: function (res) {
                    console.log(res)
                    $('#returnCode').val(res.returnCode);
                    $('#returnName').val(res.returnName);
                    $('#purchaseCode').val(res.purchaseCode);
                    $('#vendorName').val(res.vendorName);
                    $('#batchCode').val(res.batchCode);
                    $('#returnDate').val(res.returnDate.split('T')[0]);
                    $('#status').val(res.status);
                    $('#remark').val(res.remark);
                    $('#id').val(res.id);
                    form.render("select");
                }
            });
        })
    </script>
</body>
</html>

